package com.jh.paymentchannel.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.jh.paymentchannel.helipay.service.HLTopupRequest;
import com.jh.paymentchannel.util.PaymentChannelConstants;


@Component
public class PaymentChannelFactory {

    @Autowired
    private KjTopupPage kjTopupRequest;

    @Autowired
    private YiLianTopupRequest yiliantoprequest;

    @Autowired
    private ZFTGongZhongHaoTopupRequest ztfgongzhonghaoRequest;

    @Autowired
    private SwiftB2CRequest swiftB2CRequest;

    @Autowired
    private QuickPayService quickPayService;

    @Autowired
    private YBTopupService ybpay;

    @Autowired
    private YB2TopupService ybpay2;

    @Autowired
    private HLTopupRequest hlpay;

    @Autowired
    private SFTopupRequest sfpay;

    @Autowired
    private JFQuickTopupRequest jfQuickTopupRequest;

    @Autowired
    private JFMQuickTopupRequest jfmQuickTopupRequest;

    @Autowired
    private JFCoinQuickTopupRequest jfCoinQuickTopupRequest;

    @Autowired
    private JFAPITopupRequest jfApiTopupRequest;

    @Autowired
    private YHTopupRequest yhTopupRequest;

    @Autowired
    private CJTopupRequest cjTopupRequest;

    @Autowired
    private CJQuickTopupRequest cjQuickTopupRequest;

    @Autowired
    private XJYQuickTopupRequest xjyQuickTopupRequest;

    @Autowired
    private XJYCoinTopupRequest xjyCoinTopupRequest;

    @Autowired
    private HLPayTopupPage hlPayTopupPage;

    @Autowired
    private JFshangaoTopupRequest jFshangaoTopupRequest;

    @Autowired
    private ELongTopupRequest elongTopupRequest;

    @Autowired
    private MiLianTopupRequest miLianTopupRequest;

    /**
     * 支付宝APP支付
     */
    @Autowired
    private AlipayAppPayTopupRequest alipayAppPayTopupRequest;

    @Autowired
    private MiLianQuickTopupRequest miLianQuickTopupRequest;

    /**
     * 米刷代付请求
     */
    @Autowired
    private HuiZhiQuickTopupRequest huiZhiQuickTopupRequest;

    @Autowired
    private WechatTopupRequest wechatTopupRequest;

    public RepaymentRequest getRepaymentChannelRequest(String channelcode) {
        RepaymentRequest repaymentRequest = null;
        if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_MILIAN_QUICK)) {
            repaymentRequest = miLianQuickTopupRequest;
        }

        return repaymentRequest;
    }

    public TopupRequest getTopupChannelRequest(String channelcode) {

        TopupRequest paymentRequest = null;

        if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_YILIAN)) {

            paymentRequest = yiliantoprequest;

        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_SF) || channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_SF2)
                || channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_SF3)) {

            paymentRequest = sfpay;

        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_HL)) {

            paymentRequest = hlpay;

        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_YB)) {

            paymentRequest = ybpay;

        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_YB2)) {

            paymentRequest = ybpay2;

        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.QUICK_PAY)) {

            paymentRequest = quickPayService;

        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_SWIFT_FS)) {

            paymentRequest = swiftB2CRequest;

        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_JFM)) {

            paymentRequest = jfmQuickTopupRequest;

        } else if (channelcode.equalsIgnoreCase("ZTF_WEIXIN_GONGZHONGHAO") || channelcode.equalsIgnoreCase("ZTF_ALIPAY_GONGZHONGHAO")) {

            paymentRequest = ztfgongzhonghaoRequest;
        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_KJ) || channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_KJCOIN)) {
            paymentRequest = kjTopupRequest;
        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_JF)) {
            paymentRequest = jfQuickTopupRequest;
        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_JF1)) {
            paymentRequest = jfCoinQuickTopupRequest;
        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_JF2)) {
            paymentRequest = jfApiTopupRequest;
        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_YH)) {
            paymentRequest = yhTopupRequest;
        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_CJ)) {
            paymentRequest = cjTopupRequest;
        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_CJ1)) {
            paymentRequest = cjQuickTopupRequest;
        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_XJY)) {
            paymentRequest = xjyQuickTopupRequest;
        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_XJY1)) {
            paymentRequest = xjyCoinTopupRequest;
        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_HLPAY)) {
            paymentRequest = hlPayTopupPage;
        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_JFSG)) {
            paymentRequest = jFshangaoTopupRequest;
        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_EL)) {
            paymentRequest = elongTopupRequest;
        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_MILIAN)) {
            paymentRequest = miLianTopupRequest;
        } else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_MILIAN_QUICK)) {
            paymentRequest = miLianQuickTopupRequest;
        }
        //支付宝APP支付
        else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_ALIPAY_APP_PAY)) {
            paymentRequest = alipayAppPayTopupRequest;
        } //惠志支付
        else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_HUIZHI_QUICK)) {
            paymentRequest = huiZhiQuickTopupRequest;
        }
        //微信官方公众号支付
        else if (channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_GZH_WX)) {
            paymentRequest = wechatTopupRequest;
        }
//        //支付宝官方公众号支付
//        else if(channelcode.equalsIgnoreCase(PaymentChannelConstants.CHANNEL_GZH_ALI)){
//            paymentRequest =  huiZhiQuickTopupRequest;
//        }


        return paymentRequest;

    }


    public PayRequest getPayChannelRequest(String channelcode) {

        // 暂时无渠道可用
        return null;
    }

}
